﻿package Modules.PlayerModule
{
	import Modules.BulletinModule.BulletinFAQ;
	import Modules.PlayerModule.InventoryModule.Inventory;
	import Modules.VolunteerModule.Volunteer;
	import Modules.FarmModule.FarmAbstract;
	import Modules.MainTimeLine;
	import flash.display.Loader;
	
	import com.adobe.serialization.json.*;

	public class Player
	{
		//Basic variables for player
		public var playerID:String;
		public var gold:int;
		public var diamond:int;
		public var stamina:int;
		public var exp:int;
		public var level:int;
		public var gender:int;
		public var logInTime:int;
		public var farmName:String;
		public var farm:FarmAbstract;
		public var volunteerID:String;
		
		// facebook variables
		public var playerName:String;
		public var picture:Loader;
			
		//Inventory
		public var inventory:Inventory;
		
		// town hall
		public var bulletinFAQ:BulletinFAQ;
		public var volunteer:Volunteer;
		
		public function Player(playerid:String)
		{
			playerID = playerid;
			inventory =  new Inventory();
		}
		
		public function initTownHall():void{
			// town hall
			bulletinFAQ = new BulletinFAQ();
			volunteer = new Volunteer();
		}
		
		public function initInventory(loadedArray:Array):void{
			
			inventory.loadInventory(loadedArray);
			MainTimeLine.loadedPlayerInventory = true;
		}
		
		public function initFarm(decodedArray:Array):void{
			
			farm = new FarmAbstract();
			farm.setFarmObject(playerID,decodedArray);
			MainTimeLine.loadedFarm = true;
		}
	}
}